package com.szl.demo.conf;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description TODO
 * @Author xt
 * @Date 2019/10/25 0025
 * @Version 1.0
 **/
@Configuration
public class SparkConfiguration {

    @Value("${spring.application.name}")
    private String APPNAME;

    @Bean
    public SparkConf sparkConf() {
        SparkConf conf = new SparkConf().setMaster("local[*]").setAppName(APPNAME);
        return conf;
    }

    @Bean
    public JavaSparkContext javaSparkContext() {
        return new JavaSparkContext(sparkConf());
    }



}
